<?php

declare(strict_types=1);

namespace App\Request\Users;

use App\Request\FormRequest;

/**
 * Class Payer
 * @author zx
 * @package App\Request\Users
 */
class Payer extends FormRequest
{
    /**
     * 场景
     * @var array|\string[][]
     */
    protected array $scenes = [
        'save' => [
            'name',
            'id_card',
            'mobile',
            'code',
            'front_img',
            'back_img',
            'hand_front_img',
            'hand_back_img',
            'is_default'
        ],
        'code' => [
            'mobile'
        ]
    ];

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'name' => 'required|max:50',
            'id_card' => 'required|id_card',
            'mobile' => 'required|mobile',
            'code' => 'between:4,6',
            'front_img' => 'url',
            'back_img' => 'url',
            'hand_front_img' => 'url',
            'hand_back_img' => 'url',
            'is_default' => 'boolean'
        ];
    }
}
